package com.woniu.rabbit.work_model.producer;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/work_producer")
@Api(tags ="工作队列")
public class WorkProducerController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping
    @ApiOperation("工作模式生产者")
    public String workProducer(String msg) {
        rabbitTemplate.convertAndSend("work.queue",msg); // 指定队列名称
        return "消息发送成功：" + msg;
    }
}
